javascript
Brief description  about Online courses   join in Online courses
View ajay  harish 's Profile

que in an example program of classes "cars"

class car we took speed and gear as variables.then why are we initializing when as
int speed =0;
int gear=1;
program is still running if i write them as
int speed:
int gear:
wht is the use of initailizing them???
Asked by ajay harish | Mar 8, 2011 |  Reply now
Replies (1)
View nelson thomas 's Profile
primitive variables such as int, char etc.. are used to store values within its range we use these stored values in our program to meet our desired out put,by initializing these variables with values then we can use that values by using variable names in our program,otherwise programming is too difficult.if not initialized a variable we don't know what it contain.without knowing what is it , how we can use it in a logical way.
Mar 8, 2011